package com.nemodynamic.cattivial.utils;

import android.util.Log;

public class DLog {
	private static int BUFFER_LIMIT = 4000;
	private static void LOG(int priority, String TAG, String message) {	    
		if(message.length() > BUFFER_LIMIT) {
			Log.println(priority, TAG, message.substring(0, BUFFER_LIMIT));
	        LOG(priority, TAG, message.substring(BUFFER_LIMIT));
	    } else
	    	Log.println(priority, TAG, message);
	}	
	
	public static void d(String message) {
		if(Configuration.LOG_ENABLED && message != null)
			LOG(Log.DEBUG, Configuration.LOG_TAG, message);
	}
	
	public static void d(String tag, String message) {
		if(Configuration.LOG_ENABLED && message != null)
			LOG(Log.DEBUG, tag, message);
	}
	
	public static void e(String message) {
		if(Configuration.LOG_ENABLED && message != null)
			LOG(Log.ERROR, Configuration.LOG_TAG, message);
	}
	
	public static void e(String tag, String message) {
		if(Configuration.LOG_ENABLED && message != null)
			LOG(Log.ERROR, tag, message);
	}
	
	public static void i(String message) {
		if(Configuration.LOG_ENABLED && message != null)
			LOG(Log.INFO, Configuration.LOG_TAG, message);
	}
	
	public static void i(String tag, String message) {
		if(Configuration.LOG_ENABLED && message != null)
			LOG(Log.INFO, tag, message);
	}
	
	public static void v(String message) {
		if(Configuration.LOG_ENABLED && message != null)
			LOG(Log.VERBOSE, Configuration.LOG_TAG, message);
	}
	
	public static void v(String tag, String message) {
		if(Configuration.LOG_ENABLED && message != null)
			LOG(Log.VERBOSE, tag, message);
	}
	
	public static void w(String message) {
		if(Configuration.LOG_ENABLED && message != null)
			LOG(Log.WARN, Configuration.LOG_TAG, message);
	}
	
	public static void w(String tag, String message) {
		if(Configuration.LOG_ENABLED && message != null)
			LOG(Log.WARN, tag, message);
	}
}
